package com.qf.fengmimall.vo;

import com.qf.fengmimall.constant.Constants;

import java.util.HashMap;

/**
 * @author 刘欣
 * @createTime 2023/2/13 13:14
 * @description
 */
public class ResultVo extends HashMap {

    /**
     * vo
     *
     * @param obj
     * @return
     */
    public static ResultVo ok(Object obj) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code", Constants.SUCCESSCODE);
        resultVo.put("msg", "ok");
        resultVo.put("data", obj);
        return resultVo;
    }

    public static ResultVo ok() {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code", Constants.SUCCESSCODE);
        resultVo.put("msg", "ok");
        return resultVo;
    }

    /**
     * vo
     *
     * @param msg
     * @return
     */
    public static ResultVo error(String msg) {
        ResultVo resultVo = new ResultVo();
        resultVo.put("code", Constants.FAILCODE);
        resultVo.put("msg", msg);
        return resultVo;
    }
}
